package com.liuzhilong.infrastructure.basic.prototype;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author longandai@163.com
 */
@Data
@Accessors(chain = true)
public class PrototypeInfo implements Cloneable {
    private static final AtomicInteger COUNT = new AtomicInteger(0);
    private String name;
    private String info;
    public  PrototypeInfo(){
        COUNT.incrementAndGet();
        System.out.println("创建一个PrototypeInfo");
    }
    public int createCount(){
        return COUNT.get();
    }
    @Override
    public PrototypeInfo clone()  {
        try {
            return (PrototypeInfo)super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            return null;
        }
    }
}
